package com.zhijian.wharf.dao;


import com.zhijian.wharf.entity.po.User;
import com.zhijian.wharf.entity.vo.request.UserSearchVo;
import com.zhijian.wharf.entity.vo.response.UserVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserMapper {
    int deleteByPrimaryKey(Long id);

    /**
     * 按照主键批量删除
     *
     * @param idList
     * @return
     */
    int deleteByIdList(@Param("idList") List<Long> idList);

    int insert(User record);

    int insertSelective(User record);

    User selectByPrimaryKey(Long id);

    /**
     * 根据unionid查询
     *
     * @param unionid
     * @return
     */
    User selectByUnionid(String unionid);

    /**
     * 根据用户名查询
     *
     * @param userName
     * @return
     */
    User selectByUserName(String userName);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    int count(UserSearchVo userSearchVo);

    List<UserVo> selectList(UserSearchVo userSearchVo);

    UserVo selectVoById(Long id);

    /**
     * 根据工号查询
     *
     * @param jobNumber
     * @return
     */
    UserVo selectVoByJobNumber(String jobNumber);

    /**
     * 根据工号与密码查询，密码可不填
     *
     * @param jobNumber
     * @param password
     * @return
     */
    User selectByJobNumberAndPassword(@Param("jobNumber") String jobNumber, @Param("password") String password);

    /**
     * 根据手机号与密码查询，密码可不填
     *
     * @param phone
     * @param password
     * @return
     */
    User selectByPhoneAndPassword(@Param("phone") String phone, @Param("password") String password);

    /**
     * 根据手机号查询
     *
     * @param phone
     * @return
     */
    User selectByPhone(String phone);

    /**
     * 根据openID与非ID，把移动端相关参数都置为空
     *
     * @param openid
     * @param notId
     * @return
     */
    int setNullMobileParamByOpenIdAndNotId(@Param("openid") String openid, @Param("notId") Long notId);

}